<html>
<head><meta charset="utf-8"><title>Arrays and `Unsize` vs `Deref` · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Arrays.20and.20.60Unsize.60.20vs.20.60Deref.60.html">Arrays and `Unsize` vs `Deref`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244323807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Arrays%20and%20%60Unsize%60%20vs%20%60Deref%60/near/244323807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Arrays.20and.20.60Unsize.60.20vs.20.60Deref.60.html#244323807">(Jun 29 2021 at 18:12)</a>:</h4>
<p>It <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/244106884">came up</a> in portable-simd that arrays don't actually deref to slices the way that <code>Vec</code> does.  Because of that, <a href="https://doc.rust-lang.org/nightly/std/primitive.array.html">https://doc.rust-lang.org/nightly/std/primitive.array.html</a> doesn't list the slice methods, and <code>Unsize</code> isn't mentioned at all.</p>
<p>Now that we have const generics, I think we could have it be <code>Deref</code> as well.  Should it?</p>



<a name="244325995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Arrays%20and%20%60Unsize%60%20vs%20%60Deref%60/near/244325995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Arrays.20and.20.60Unsize.60.20vs.20.60Deref.60.html#244325995">(Jun 29 2021 at 18:27)</a>:</h4>
<p>I think it should...it will definitely improve array's docs and will allow using generic code that expects <code>Deref</code> such as <code>Option::as_deref</code>. It should also <code>impl DerefMut</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>